def convert_currency(amount, currency, exchange_rate):
    if currency.lower() == 'usd':
        return amount * exchange_rate
    elif currency.lower() == 'cny':
        return amount / exchange_rate
    else:
        return None


def main():
    exchange_rate = 7.0
    while True:
        amount = float(input("请输入金额: "))
        currency = input("请输入货币类型（人民币: 'cny', 美元: 'usd'): ").strip().lower()

        converted_amount = convert_currency(amount, currency, exchange_rate)
        if converted_amount is not None:
            print(f"转换后的金额是: {converted_amount:.2f}")
        else:
            print("无效的货币类型，请重新输入。")

        continue_choice = input("是否继续（y/n）: ").strip().lower()
        if continue_choice == 'n':
            print('运行结束')
            break


if __name__ == "__main__":
    main()
